<template>
      <div class="collect-lists" v-if="lists">
        <div class="lists">
          <router-link tag="div" :to="'/detail?id='+item.id" class="collect-item" v-for="item in lists" :key="item.id">
            <div class="img">
              <img :src="'https://pic.ecook.cn/web/'+ item.imageid+'.jpg!wl280'" alt="" />
            </div>
            <div class="right">
              <div class="txt-top">
                <h4 class="line-ellipsis">{{item.name}}</h4>
                <span>{{item.authorname}}</span>
              </div>
              <div class="option-btm">
                <div class="addto">
                  <img src="../assets/images/添加文件夹.png" alt="" />
                  <span>添加至</span>
                </div>
                <div class="del" @click.stop="del(item.id)">
                  <img src="../assets/images/lajitong.png" alt="" />
                  <span>删除</span>
                </div>
              </div>
            </div>
          </router-link>
        </div>
      </div>
</template>

<script>
    export default {
        props:['lists'],
        methods: {
            del(id){
                this.$emit('del',id);
            }
        },
    }
</script>

<style lang="less" scoped>
    .collect-lists {
      width: 100%;
      height: 405px;
      overflow-y: scroll;
      position: relative;
      .lists {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        
        .collect-item {
          padding: 5px 25px;
          height: 100px;
          display: flex;
          margin-bottom: 8px;

          .img {
            flex: 0 0 140px;
            height: 100px;
            border-radius: 8px;
            overflow: hidden;
            & > img {
              width: 100%;
              height: 100%;
            }
          }
          .right {
            flex: 1;
            margin-left: 12px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            .txt-top {
              & > h4 {
                font-size: 16px;
                font-weight: bold;
                margin: 5px 0 10px 0;
                letter-spacing: 0.8px;
                line-height: 22px;
              }
              & > span {
                color: #999;
                font-weight: bold;
                font-size: 14px;
                letter-spacing: 0.8px;
              }
            }
            .option-btm {
              display: flex;
              align-items: center;
              justify-content: flex-end;
              .addto {
                display: flex;
                align-items: center;
                & > img {
                  width: 18px;
                  height: 18px;
                  margin-right: 3px;
                }
                & > span {
                  font-size: 14px;
                  color: #999;
                  letter-spacing: 0.4px;
                }
              }
              .del {
                display: flex;
                align-items: center;
                margin-left: 15px;
                & > img {
                  width: 18px;
                  height: 18px;
                  margin-right: 3px;
                }
                & > span {
                  font-size: 14px;
                  color: #999;
                  letter-spacing: 0.4px;
                }
              }
            }
          }
        }
      }
    }
</style>